Skip to content

@W-20224267 Passkey login in checkout#3585

Merged
hajinsuha1 merged 34 commits intofeature/webauthn-loginfrom
W-20224267-passkey-login-in-checkout
Jan 29, 2026
Merged

@W-20224267 Passkey login in checkout#3585
hajinsuha1 merged 34 commits intofeature/webauthn-loginfrom
W-20224267-passkey-login-in-checkout

Conversation

@hajinsuha1
Copy link
Collaborator

@hajinsuha1 hajinsuha1 commented Jan 19, 2026

Description

Integrates the passkey login flow into the checkout page.

Screenshot 2026-01-26 at 2 40 07 PM

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • add new usePasskeyLogin hook to be used to initiate passkey login
  • call usePasskeyLogin from ContactInfo page
  • merge basket
  • error handling

How to Test-Drive This PR

navigate to https://wasatch-mrt-jinsu.sfdc-shbmgi-ecom1.exp-delivery-staging-ci.com/

No Passkey Registered

  1. Add an item to your cart
  2. Navigate to the checkout page
  3. Verify you are not prompted for a passkey and no error is displayed

Passkey Registered

  1. Login via password or passwordless and register a passkey using the Create Passkey prompt
    1. Get the OTP code from your email
  2. Logout
  3. Add an item to your cart
  4. Navigate to the checkout page
  5. Follow the prompts to login with your passkey
  6. Verify you are logged in and items in your basket have been merged

Error messages

  1. Logout and open the checkout page again
  2. Cancel all the passkey login prompts and verify a something went wrong error message is displayed
Screenshot 2026-01-26 at 3 59 32 PM

Passkey feature disabled

  1. Start the app locally
git checkout W-20224267-passkey-login-in-checkout
cd packages/template-retail-react-app
npm start
  1. Add an item to your cart
  2. Navigate to the checkout page
  3. Verify you are not prompted for a passkey and no error is displayed

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jan 19, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@hajinsuha1 hajinsuha1 added the skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated label Jan 23, 2026
Comment on lines +1541 to +1542
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore TODO: user_id is optional, but commerce-sdk-isomorphic expects it to be required. Remove this comment after commerce-sdk-isomorphic is updated.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove this comment after commerce-sdk-isomorphic is updated with recent OAS change that makes user_id optional

* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
/* global PublicKeyCredential */
Copy link
Collaborator Author

@hajinsuha1 hajinsuha1 Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently eslint is using es6 which does not contain PublicKeyCredential.
This fix allows us to use it without updating the eslint config. Later we can speak to the PWA kit about upgrading but for now it seems this is the practice that is used for other similar variables

@hajinsuha1 hajinsuha1 marked this pull request as ready for review January 23, 2026 20:03
@hajinsuha1 hajinsuha1 requested a review from a team as a code owner January 23, 2026 20:03
Comment on lines +171 to +173
} catch (error) {
setError(formatMessage(API_ERROR_MESSAGE))
}
Copy link
Collaborator Author

@hajinsuha1 hajinsuha1 Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we catch any errors and that were thrown during the webauthn flow and display a generic error message. More detailed error handling will be done as part of https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00002TfC8TYAV/view

hajinsuha1 and others added 4 commits January 27, 2026 10:50
… login, ensuring basket is merged for registered customers.
…in/registration pages to ensure consistent access through the window object.
Comment on lines +19 to +23
const uint8arrayToBase64url = (input) => {
const uint8array = new Uint8Array(input)
const base64 = base64Encode(uint8array.buffer)
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have to address this in this PR but it seems this util function is used across multiple components for webauthn. We should consider placing this in a utils module

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

yunakim714
yunakim714 previously approved these changes Jan 27, 2026
@yunakim714 yunakim714 dismissed their stale review January 27, 2026 20:13

Found some bugs during testing

hajinsuha1 and others added 4 commits January 28, 2026 09:26
Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com>
Signed-off-by: Jinsu Ha <91205717+hajinsuha1@users.noreply.github.com>
… ArrayBuffer to base64url conversion, improving code reusability and clarity. Add unit tests for the new utility function.
@hajinsuha1 hajinsuha1 merged commit 6c26eba into feature/webauthn-login Jan 29, 2026
18 of 42 checks passed
@hajinsuha1 hajinsuha1 deleted the W-20224267-passkey-login-in-checkout branch January 29, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants